package com.hd.openapi.servies.serviceimpl;

import com.github.pagehelper.PageHelper;
import com.hd.openapi.common.ResponseResult;
import com.hd.openapi.common.ResultTable;
import com.hd.openapi.dao.AdminUserMapper;
import com.hd.openapi.dao.MenuMapper;
import com.hd.openapi.entity.Menu;
import com.hd.openapi.servies.cdmenuser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class cdmenuIMPL implements cdmenuser {
    @Autowired
    private MenuMapper ma;

    @Override
    public ResultTable getpagelimit(Integer page, Integer limit) {
        List<Menu> getdata = ma.getmenualldata ();
        return new ResultTable (0,"",getdata.size (),getdata);
    }

    @Override
    public ResponseResult adddata(Menu menu) {
        int i = ma.insertSelective (menu);
        return ResponseResult.getSuccess ();
    }

    @Override
    public ResponseResult updatadata(Menu menu) {
        int i = ma.updateByPrimaryKeySelective (menu);
        return ResponseResult.getSuccess ();
    }

    @Override
    public Menu getmenudata(Integer id) {
        Menu menu = ma.selectByPrimaryKey (id);
        return  menu;
    }

    @Override
    public ResponseResult deletedata(Integer[] ids) {
       int i = ma.deleteda(ids);
        return ResponseResult.getSuccess ();
    }

}
